package com.simple.puzzle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class ChoicePicture extends Activity implements OnClickListener {

	static final int CHOICE_PICTURE = 3;
	ImageView pic_one;
	ImageView pic_two;
	ImageView pic_three;
	ImageView pic_four;
	ImageView pic_five;
	ImageView pic_six;
	ImageView pic_seven;

	int id;

	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.choice_picture);

		pic_one = (ImageView) findViewById(R.id.pic_1);
		pic_two = (ImageView) findViewById(R.id.pic_2);
		pic_three = (ImageView) findViewById(R.id.pic_3);
		pic_four = (ImageView) findViewById(R.id.pic_4);
		pic_five = (ImageView) findViewById(R.id.pic_5);
		pic_six = (ImageView) findViewById(R.id.pic_6);
		pic_seven = (ImageView) findViewById(R.id.pic_7);

		pic_one.setOnClickListener(this);
		pic_two.setOnClickListener(this);
		pic_three.setOnClickListener(this);
		pic_four.setOnClickListener(this);
		pic_five.setOnClickListener(this);
		pic_six.setOnClickListener(this);
		pic_seven.setOnClickListener(this);
	}

	public void dismiss() {
		Intent intent = new Intent();
		intent.putExtra("picture", id);
		setResult(Activity.RESULT_OK, intent);
		finish();
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if (v == pic_one) {
			id = R.drawable.pic_one;
			dismiss();
		}
		if (v == pic_two) {
			id = R.drawable.pic_two;
			dismiss();
		}
		if (v == pic_three) {
			id = R.drawable.pic_three;
			dismiss();
		}
		if (v == pic_four) {
			id = R.drawable.pic_four;
			dismiss();
		}
		if (v == pic_five) {
			id = R.drawable.pic_five;
			dismiss();
		}
		if (v == pic_six) {
			id = R.drawable.pic_six;
			dismiss();
		}if (v == pic_seven) {
			id = R.drawable.pic_seven;
			dismiss();
		}
		
	}

}
